package com.smartfactory.sail.controller;


import com.ada.base.common.ApiResponse;
import com.ada.base.common.ControllerResponse;
import com.smartfactory.sail.service.ICommonService;
import com.smartfactory.sail.vo.PageParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 员工考勤 前端控制器
 * </p>
 *
 * @author 王巨壁
 * @since 2019-07-24
 */
@Api(tags = "员工考勤")
@RestController
@RequestMapping("/user-attendance")
public class UserAttendanceController extends ControllerResponse {

    private ICommonService iCommonService;

    public UserAttendanceController(ICommonService iCommonService) {
        this.iCommonService = iCommonService;
    }

    @ApiOperation(value = "员工考勤列表 分页|currentPage|size|sortType|sortField 必传", notes = "员工考勤列表 分页|currentPage|size|sortType|sortField 必传")
    @PostMapping("list/{currentPage}/{size}/{sortType}/{sortField}")
    public ApiResponse<Object> listMaterial(@RequestBody Map<String ,Object> queryParam,
                                            @PathVariable("currentPage")Long currentPage,
                                            @PathVariable("size")Integer size,
                                            @PathVariable("sortType")Integer sortType,
                                            @PathVariable("sortField")String sortField) {
        PageParam pageParam = new PageParam(currentPage,size,sortType,sortField);
        return  ok(iCommonService.listByPageAndQueryParam(queryParam,pageParam,"select * from user_attendance"));
    }
}
